<?php

/**
 * PluginygmPerCredential form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class PluginygmPerCredentialForm extends BaseygmPerCredentialForm {

    public function setupInheritance() {

        parent::setupInheritance();
        //Fremove Required validators from these fields.
        unset($this->validatorSchema['created_at']);
        unset($this->validatorSchema['updated_at']);
        //remove fields from form
        unset($this->widgetSchema['created_at']);
        unset($this->widgetSchema['updated_at']);


        $this->validatorSchema['imagen'] = new sfValidatorFile(array(
                    'required' => false,
                    'path' => sfConfig::get('sf_upload_dir') . '/credential',
                    'mime_types' => 'web_images',
                ));

        $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array(
                    'label' => 'Icone',
                    'file_src' => '/uploads/credential/' . $this->getObject()->getImagen(),
                    'is_image' => true,
                    'edit_mode' => !$this->isNew(),
                    'template' => '<div> %input% %delete% %file%</div>',
                ));

        $this->validatorSchema['imagen_delete'] = new sfValidatorPass();
    }

}
